from django.shortcuts import render
from .models import Student
# Create your views here.


def get_student(request):
    studens = Student.objects.all()
    student_dict = {
        'name': 'lingxue',
        'age': 22,
        'sex': '女',
    }
    data = {
        'students': studens,
        'student_dict':student_dict,
    }
    return render(request, 'myapp/showStudent.html', data)


def get_for(request):
    students = Student.objects.filter(name='aaa')  # 空内容
    stus = Student.objects.all()
    data = {
        'students': students,
        'stus': stus,
    }
    return render(request, 'myapp/showfor.html', data)


def get_index(requset):
    return render(requset, 'myapp/index.html', {'title': 'index页面'})